<template>
  <view class="">
    <view class="bg-white">
      <view v-for="item in list" :key="item.id" class="flex-a h-40 px-14 hair--b">
        <image class="item-logo" :src="item.headimgurl" mode="" />
        <view class="flex-1 mx-5 ellipsis-1">{{ item.nickname }}</view>
        <view class="text-info text-12">{{ $f.formatDate(item.create_time) }}</view>
      </view>
    </view>
    <uni-load-more :status="$f.getLoading(loading)" />
  </view>
</template>
<script>
export default {
  data() {
    return {
      list: [],
      page: 1,
      loading: 0,
      limit: 10
    }
  },
  onLoad() {
	  this.getList()
  },
  onReachBottom() {
	  this.getList()
  },
  methods: {
    getList() {
      if (this.loading) return
      this.loading = 1
      this.$f.post('api/userChild', {
        page: this.page,
        limit: this.limit
      }).then(res => {
        this.loading = this.limit > res.data.length ? 2 : 0
        if (res.data.length) {
          this.list = [...this.list, ...res.data]
          this.page += 1
        }
      })
    }
  }
}
</script>

